﻿@using System.ComponentModel
@using System.Net.Mime
@using Project_KhuyenMaiVang.Models
@model Project_KhuyenMaiVang.Models.TinKhuyenMaiModel        
@{    
    <script type="text/javascript" src="@Url.Content("~/Scripts/EditorScripts/innovaeditor.js")"></script>
    ViewBag.Title = "DangKyTinKhuyenMai";
    Layout = "~/Views/Shared/_LayoutDoanhNghiep.cshtml";
    List<Project_KhuyenMaiVang.Models.SanPhamDTO> list = ViewBag.DSSanPham;
    var items = new SelectList(list, "MaSanPham", "TenSanPham");
    List<Project_KhuyenMaiVang.Models.LoaiSanPhamDTO> listloaisp = ViewBag.DsLoaiSanPham;    
    var LoaiSpItems = new SelectList(listloaisp, "MaLoaiSanPham", "TenLoaiSanPham");

    List<Project_KhuyenMaiVang.Models.HinhThucGiaoHangDTO> DsHinhThucGiaoHang = ViewBag.DsHinhThucGiaoHang;
    var HinhThucGiaoHangItems = new SelectList(DsHinhThucGiaoHang, "MaHinhThucGiaoHang", "TenHinhThucGiaoHang");

    List<Project_KhuyenMaiVang.Models.KhuVucDTO> DsKhuVuc = ViewBag.DsKhuVuc;
    var KhuVucItems = new SelectList(DsKhuVuc, "MaKhuVuc", "TenKhuVuc");
            
    bool SuDungSanPhamCoSan = true;               
}
<link type="text/css" href="@Url.Content("~/Content/OpenSource/Datapicker/css/ui-lightness/jquery-ui-1.8.19.custom.css")" rel="stylesheet" />
<script type="text/javascript" src="@Url.Content("~/Content/OpenSource/Datapicker/js/jquery-1.7.2.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/OpenSource/Datapicker/js/jquery-ui-1.8.19.custom.min.js")"></script>
<link type="text/css" href="@Url.Content("~/Content/OpenSource/Dialog/css/dot-luv/jquery-ui-1.8.19.custom.css")" rel="stylesheet" />
<script type="text/javascript" src="@Url.Content("~/Content/OpenSource/Dialog/js/jquery-1.7.2.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/OpenSource/Dialog/js/jquery-ui-1.8.19.custom.min.js")"></script>
<script>
    $(document).ready(function () {
        $("#ThemSanPham").hide();

        $("#isNhapSanPhamMoi").click(function () {
            $("#ThemSanPham").toggle(1000);
        });
    });
</script>
<script>
    $(document).ready(function () {
        $("#TinKhuyenMaiDTO_NgayBatDau").datepicker();
        $("#anim").change(function () {
            $("#TinKhuyenMaiDTO_NgayBatDau").datepicker("option", "showAnim", $(this).val());
        });
        $("#TinKhuyenMaiDTO_NgayBatDau").datepicker("option", "dateFormat", "dd/mm/yy");
    });
</script>
<script>
    $(document).ready(function () {
        $("#TinKhuyenMaiDTO_NgayKetThuc").datepicker();
        $("#anim").change(function () {
            $("#TinKhuyenMaiDTO_NgayKetThuc").datepicker("option", "showAnim", $(this).val());
        });
        $("#TinKhuyenMaiDTO_NgayKetThuc").datepicker("option", "dateFormat", "dd/mm/yy");
    });
</script>
@using (Html.BeginForm(Html.BeginForm("DangKyTinKhuyenMai", "DoanhNghiep", FormMethod.Post, new { enctype = "multipart/form-data" })))
{
    @Html.ValidationSummary(true)
    <form id="formkhuyenmai" name="formkhuyenmai" method="post" action="">
    <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td colspan="3">
                <div align="center" class="TieuDeTheTable">
                    ĐĂNG KÝ TIN KHUYẾN MÃI</div>
            </td>
        </tr>
        <tr>
        </tr>
        <tr>
            <td>
                Mã sản phẩm
            </td>
            <td>
                @Html.DropDownListFor(model => model.TinKhuyenMaiDTO.MaSanPham, items)
            </td>
            <td>
                @Html.CheckBoxFor(model => model.isNhapSanPhamMoi) Nhập sản phẩm mới.
            </td>
        </tr>
        <tr>
            <td>
                Giá khuyến mãi
            </td>
            <td>
                @Html.EditorFor(model => model.TinKhuyenMaiDTO.GiaKhuyenMai)
                @Html.ValidationMessageFor(model => model.TinKhuyenMaiDTO.GiaKhuyenMai)
            </td>
        </tr>
        <tr>
            <td>
                Thông tin tóm tắt
            </td>
            <td>
                @Html.TextAreaFor(model => model.TinKhuyenMaiDTO.ThongTinTomTat)
                @Html.ValidationMessageFor(model => model.TinKhuyenMaiDTO.ThongTinTomTat)
            </td>
        </tr>
        <tr>
            <td>
                Thời gian bắt đầu
            </td>
            <td>
                @Html.EditorFor(model => model.TinKhuyenMaiDTO.NgayBatDau)
                @Html.ValidationMessageFor(model => model.TinKhuyenMaiDTO.NgayBatDau)
            </td>
        </tr>
        <tr>
            <td>
                Thời gian kết thúc
            </td>
            <td>
                @Html.EditorFor(model => model.TinKhuyenMaiDTO.NgayKetThuc)
                @Html.ValidationMessageFor(model => model.TinKhuyenMaiDTO.NgayKetThuc)
            </td>
        </tr>
        <tr>
            <td>
                Hình thức giao hàng
            </td>
            <td>
                @Html.DropDownListFor(model => model.TinKhuyenMaiDTO.MaHinhThucGaoHang,HinhThucGiaoHangItems)                
            </td>
        </tr>
                <tr>
            <td>
                Khu vực
            </td>
            <td>
                @Html.DropDownListFor(model => model.TinKhuyenMaiDTO.MaKhuVuc,KhuVucItems)               
            </td>
        </tr>
        <tr>
            <td>
                Số lượng khuyến mãi
            </td>
            <td>
                @Html.EditorFor(model => model.TinKhuyenMaiDTO.SoLuongKhuyenMai)
                @Html.ValidationMessageFor(model => model.TinKhuyenMaiDTO.SoLuongKhuyenMai)
            </td>
        </tr>
        <tr>
            <td>
                Điều kiện sử dụng
            </td>
            <td>
                @Html.TextAreaFor(model => model.TinKhuyenMaiDTO.DieuKienSuDung)
            </td>
            <script>
                var oEdit3 = new InnovaEditor("oEdit3");
                oEdit3.REPLACE("TinKhuyenMaiDTO_DieuKienSuDung"); 
            </script>
        </tr>
        <tr>
            <td>
                Điểm nổi bật
            </td>
            <td>
                @Html.TextAreaFor(model => model.TinKhuyenMaiDTO.DiemNoiBat)
            </td>
            <script>                //STEP 2: Replace the textarea (txtContent)
                var oEdit2 = new InnovaEditor("oEdit2");
                oEdit2.REPLACE("TinKhuyenMaiDTO_DiemNoiBat"); //Specify the id of the textarea here
            </script>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td align="center">
                <input type="submit" value="Create" onclick="" />
            </td>
        </tr>
    </table>
    <div id="ThemSanPham">
        <table width="600" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td colspan="2">
                    <div align="center" class="TieuDeTheTable">
                        THÔNG TIN SẢN PHẨM</div>
                </td>
            </tr>
            @Html.HiddenFor(model => model.SanPhamDTO.MaSanPham)
            <tr>
                <td>
                    Tên sản phẩm
                </td>
                <td>
                    @Html.EditorFor(model => model.SanPhamDTO.TenSanPham)
                    @Html.ValidationMessageFor(model => model.SanPhamDTO.TenSanPham)
                </td>
            </tr>
            <tr>
                <td>
                    Upload ảnh 1
                </td>
                <td>
                    <input type="file" name="filehinh1" id="filehinh1" />
                </td>
            </tr>
            <tr id="ThemSanPham">
                <td>
                    Upload ảnh 2
                </td>
                <td>
                    <input type="file" name="filehinh2" id="filehinh2" />
                </td>
            </tr>
            <tr>
                <td>
                    Upload ảnh 3
                </td>
                <td>
                    <input type="file" name="filehinh3" id="filehinh3" />
                </td>
            </tr>
            <tr>
                <td>
                    Mã loại sản phẩm
                </td>
                <td>
                    @Html.DropDownListFor(model => model.SanPhamDTO.MaLoaiSanPham, LoaiSpItems)
                </td>
            </tr>
            <tr>
                <td>
                    Giá gốc
                </td>
                <td>
                    @Html.EditorFor(model => model.SanPhamDTO.GiaGoc)
                    @Html.ValidationMessageFor(model => model.SanPhamDTO.GiaGoc)
                </td>
            </tr>
            <tr>
                <td>
                    Mô tả chi tiết
                </td>
                <td>
                    @Html.TextAreaFor(model => model.SanPhamDTO.MoTaChiTiet)
                </td>
                <script>                    //STEP 2: Replace the textarea (txtContent)
                    var oEdit1 = new InnovaEditor("oEdit1");
                    oEdit1.REPLACE("SanPhamDTO_MoTaChiTiet"); //Specify the id of the textarea here
                </script>
            </tr>
        </table>
    </div>
    </form>
        

    
}
